package com.zzxy.springmvc34.controller;

import com.zzxy.springmvc34.po.Student;
import com.zzxy.springmvc34.po.StudentExt;

@Controller
@RequestMapping("/stu")
public class StudentController{
    @RequestMapping("register.do")
    public String register(){return "/user/register";}
    @RequestMapping("insert")
    public @RequestBody Student inser(@requestBody Student student){
        //service > dao > jdbctemplote >mysql
        //service > dao >mybatis >mysql
        student.setUsername(student.getUsername()+"123");
        student.setPassword(student.getPassmord()+"abc");
        return student;
    }
    @RequestMapping("addStu")
    public String addStudent(String username,String password,Model model){
        System.out.println(username);
        System.out.println(password);
        model.addAttribute("username",username);
        model.addAttribute("password",password);
        return "/user/userList";
    }
    @RequestMapping("addStu1")
    public String addStudent1(Student student){
        System.out.println(student);
        return "/user/userList";
    }
    @RequestMapping("addStu2")
    public String addStudent2(StudentExt ext){
        //  System.out.println(ext.getStudent());
        /*for (Student student ; ext.setStudentList()){
        System.out.println(student);
        }*/
        System.out.println(ext);
        return "/user/userList";
    }
    @RequestMapping("text")
    public String test() { return "redirect:register.do"; }
}